<template>
  <SzCrudSingle ref="refSzCrudSingle" :cellClassName="cellClassName"
                :crm-type="crmType"
                :create-type="crmType"
                addBtnText="新建线索"
                search-place-holder="请输入线索名称/手机/电话">
    <template v-slot:detail="{crmOption, elTableOption,fieldAndListOption,handleHandle,crmOptionChange}">
      <BusinessDetail v-model:visible="crmOption.showDview"
                      v-model:id="elTableOption.rowID"
                      :crmOptionChange="crmOptionChange"
                      :page-list="crmOption.crmType == elTableOption.rowType ? fieldAndListOption.dataList : []"
                      v-model:page-index="elTableOption.rowIndex"
                      class="d-view" @hide-view="crmOption.showDview=false" @handle="handleHandle"></BusinessDetail>
    </template>
    <template v-slot:create="{crmOption, elTableOption,fieldAndListOption,handleHandle,crmOptionChange}">
      <BusinessCreate v-if="crmOption.createShow" :createAction="crmOption.createAction"
                      @close="crmOption.createShow = false"
                      @save-success="handleHandle"/>
    </template>

  </SzCrudSingle>
</template>

<script setup>
import BusinessCreate from './Create.vue'
import BusinessDetail from './Detail.vue'
import SzCrudSingle from "/src/views/crm/componentsNew/SzCrud/SzCrud.vue";
import {floatAdd} from "utils";
import {useNumberHook} from "@/hooks/useNumberHook.js";

defineOptions({
  /** 客户管理 的 产品列表 */
  name: 'LeadsIndex',
})


const crmType = ref('leads')

const {separator} = useNumberHook();
/**
 * 通过回调控制class
 */
function cellClassName({row, column, rowIndex, columnIndex}) {
  if (column.property === 'leadsName') {
    return 'can-visit--underline'
  } else {
    return ''
  }
}

const refSzCrudSingle = ref()


</script>


<style lang="scss" scoped>
@import '../styles/table';
</style>
